/*
 ============================================================================
 Name		: VibraMassagerContainer.h
 Author	  : 
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CVibraMassagerContainer declaration
 ============================================================================
 */

#ifndef VIBRAMASSAGERCONTAINER_H
#define VIBRAMASSAGERCONTAINER_H

// INCLUDES
#include <coecntrl.h>
#include <HWRMVibra.h>
// CLASS DECLARATION

/**
 *  CVibraMassagerContainer
 * 
 */
class CVibraMassagerContainer : public CCoeControl, MCoeControlObserver, MHWRMVibraObserver
	{
public:
	enum TVibraMassagerState
		{
		EVibraMassagerOn = 0,
		EVibraMassagerOff
		};
private:
	enum
	{
	EVibraStateUnKnown = 0,
	EVibraStateRunning,
	EVibraStateStopped
	};	
	
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CVibraMassagerContainer();

	/**
	 * Two-phased constructor.
	 */
	static CVibraMassagerContainer* NewL(const TRect& aRect);

	/**
	 * Two-phased constructor.
	 */
	static CVibraMassagerContainer* NewLC(const TRect& aRect);

private:

	/**
	 * Constructor for performing 1st stage construction
	 */
	CVibraMassagerContainer();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL(const TRect& aRect);

public:
	// Functions from base classes
	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);

private:
	// Functions from base classes
	void SizeChanged();
	TInt CountComponentControls() const;
	CCoeControl* ComponentControl(TInt aIndex) const;
	void Draw(const TRect& aRect) const;
	void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
	void HandlePointerEventL( const TPointerEvent& aEvent );
	void HandleResourceChange( TInt aType );
	
    // from MHWRMVibraObserver
    virtual void VibraModeChanged(CHWRMVibra::TVibraModeState aState);
    virtual void VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus);	
    
public:
	void Vibra();
	
	void VibraOn();
	void VibraOff();

private:
	//data
	CHWRMVibra*               	iVibra;
	
	TVibraMassagerState 		iState;
	TInt 						iVibraState;
	
	CFbsBitmap* 	iImgLight;
	CFbsBitmap*  	iImgLightGray;
	CFbsBitmap* 	iImgLightMask;
	};

#endif // VIBRAMASSAGERCONTAINER_H
